<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	
	<!-- Шаблоно-обработчик постраничной навигации -->
	<xsl:include href="../common/navigation.xsl" />
	
	<xsl:template match="/data">
		<html>
			<head>
				<title>
					<xsl:value-of select="@title" />
				</title>
			</head>
			<body>
				
			<xsl:apply-templates select="response/object[@type='article' or @type='link']" />
			
			<xsl:apply-templates select="pages" mode="pages-navigation">
				<xsl:with-param name="href">
					<xsl:text>/mymodule</xsl:text>
				</xsl:with-param>
			</xsl:apply-templates>
	
			</body>
		</html>
	</xsl:template>
	
	<!-- Шаблон для статей -->
	<xsl:template match="object[@type='article']">
		<xsl:param name="id" select="@id" />
		
		<div>
			<xsl:text>Cтатья: </xsl:text>
			<a href="/blogs/post/article/{$id}">
				<xsl:value-of select="property[@name='title']/value" />
			</a>
			<xsl:text> </xsl:text>
			<small>
				<xsl:value-of select="property[@name='pubdate']/value" />
			</small>
		</div>
	</xsl:template>
	
	<!-- Шаблон для ссылок -->
	<xsl:template match="object[@type='link']">
		<xsl:param name="id" select="@id" />
		
		<div>
			<xsl:text>Ссылка: </xsl:text>
			<a href="/blogs/post/link/{$id}">
				<xsl:value-of select="property[@name='title']/value" />
			</a>
			<xsl:text> </xsl:text>
			<small>
				<xsl:value-of select="property[@name='pubdate']/value" />
			</small>
		</div>
	</xsl:template>
	
</xsl:stylesheet>